/************************************************************************/
// Copyright (C) 2016, han_gangbiao. All rights reserved.
// Use of this source code is governed by a GPL-v2 license that can be found in the License file.
// 
// [Time]:      2016-1-4 21:53:17
// [Author]:    han_gangbiao [http://my.oschina.net/jackhen]
// [Info]:      
/************************************************************************/

#ifndef INCLUDE_BASE_BASEHEADER_H_
#define INCLUDE_BASE_BASEHEADER_H_

#define BEG_NS_SMART namespace smart {
#define END_NS_SMART }

#ifdef SAFE_DELETE
#undef SAFE_DELETE
#endif

#ifdef SAFE_ARRAY_DELETE
#undef SAFE_ARRAY_DELETE
#endif 

#ifdef SAFE_RELEASE
#undef SAFE_RELEASE
#endif

#define SAFE_DELETE(obj)        do { if(obj) { delete obj; obj=NULL; } } while(0)
#define SAFE_ARRAY_DELETE(obj)  do { if(obj) { delete [] obj; obj=NULL; } } while(0)
#define SAFE_RELEASE(obj)       do { if(obj) { obj->release(); obj=NULL; } } while(0)


#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/timeb.h>
#include <time.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <netdb.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <sys/stat.h>
#include <sys/uio.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/un.h>
#include <errno.h>
#include <sys/select.h>
#include <poll.h>
#include <pthread.h>
#include <sys/ioctl.h>
#include <assert.h>
#include <sys/prctl.h>


typedef unsigned char byte;
typedef char int8;
typedef unsigned char uint8;
typedef uint8 boolean;
typedef short int16;
typedef unsigned short uint16;
typedef int int32;
typedef unsigned int uint32;
typedef float float32;
typedef double float64;
typedef unsigned char octet;

#if !defined(TRUE)
#   define TRUE    ((boolean)1)
#endif

#if !defined(FALSE)
#   define FALSE   ((boolean)0)
#endif

#undef NULL //C++11 is nullptr [-Wconversion-null]
#if !defined(NULL)
#   if defined(__cplusplus)
#       define NULL     0
#   else
#       define NULL     ((void*)0)
#   endif
#endif

#if defined(LINUX) || defined(_LINUX) || defined(__linux__)
    typedef unsigned short WORD;
    typedef unsigned int DWORD;
    typedef int BOOL;
    typedef unsigned int UINT;
    
    typedef long long int64;
    typedef unsigned long long uint64;
#endif

#if !defined(MAX_PATH)
#   define MAX_PATH 260
#endif


#endif //~INCLUDE_BASE_BASEHEADER_H_
